module.exports.readPropFileSync = function(path) {
	try {
		var props = {};
		var lines = require('fs')
			.readFileSync(path)
			.toString()
			.split('\n')
			.map(line => {
				if (line.substr(line.length - 1) == '\r') line = line.substr(0, line.length - 1);
				var kv = line.split('=');
				if (kv.length == 2) {
					props[kv[0]] = kv[1].replace('\\:', ':').replace(/\\\\/g, '\\');
				}
			});
		return props;
	} catch (error) {
		console.log(error);
	}
};

module.exports.deleteFolderRecursive = function(path) {
	var fs = require('fs');
	if (fs.existsSync(path)) {
		fs.readdirSync(path).forEach(function(file, index) {
			var curPath = path + '/' + file;
			if (fs.lstatSync(curPath).isDirectory()) {
				// recurse
				module.exports.deleteFolderRecursive(curPath);
			} else {
				// delete file
				fs.unlinkSync(curPath);
			}
		});
		fs.rmdirSync(path);
	}
};
